package com.lightningtrade.service.impl;

import com.lightningtrade.domain.SysFlashSale;
import com.lightningtrade.mapper.SysFlashSaleMapper;
import com.lightningtrade.service.SysFlashSaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysFlashSaleServiceImpl implements SysFlashSaleService {

    @Autowired
    private SysFlashSaleMapper sysFlashSaleMapper;

    @Override
    public boolean addFlashSale(SysFlashSale flashSale) {
        return sysFlashSaleMapper.insertFlashSale(flashSale) > 0;
    }

    @Override
    public boolean updateFlashSale(SysFlashSale flashSale) {
        return sysFlashSaleMapper.updateFlashSale(flashSale) > 0;
    }

    @Override
    public boolean deleteFlashSale(int id) {
        return sysFlashSaleMapper.deleteFlashSaleById(id) > 0;
    }

    @Override
    public SysFlashSale getFlashSaleById(int id) {
        return sysFlashSaleMapper.selectFlashSaleById(id);
    }

    @Override
    public List<SysFlashSale> getAllFlashSales() {
        return sysFlashSaleMapper.selectAllFlashSales();
    }
}
